package com.xiangban.yanglaodajie_admin.controller;

import com.xiangban.yanglaodajie_admin.aop.Permission;
import com.xiangban.yanglaodajie_admin.entity.Honor;
import com.xiangban.yanglaodajie_admin.entity.Ids;
import com.xiangban.yanglaodajie_admin.entity.Leader;
import com.xiangban.yanglaodajie_admin.entity.dto.ShopExpandDto;
import com.xiangban.yanglaodajie_admin.entity.res.ApiResult;
import com.xiangban.yanglaodajie_admin.service.ShopExpandService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Mr. MaYaYun
 * @Data 2021/7/22 15:38
 */
@RestController
@RequestMapping("/api/admin/shop_expand")
@Api(tags = "商家拓展信息")
public class ShopExpandController {

    @Autowired
    private ShopExpandService shopExpandService;

    @PostMapping("/getShopExpand")
    @ApiOperation("获取商家拓展信息")
    @Permission(permission = "admin:shop_expand:getShopExpand")
    public Object getShopExpand(){
        return ApiResult.newSuccess(shopExpandService.getShopExpand());
    }

    @PostMapping("/addOrUpdShopExpand")
    @ApiOperation("添加或修改信息")
    @Permission(permission = "admin:shop_expand:addOrUpdShopExpand")
    public ApiResult<Object> addOrUpdShopExpand(@RequestBody ShopExpandDto shopExpandDto){
        shopExpandService.addOrUpdShopExpand(shopExpandDto);
        return ApiResult.newSuccess();
    }

    @PostMapping("/getLeaderList")
    @ApiOperation("学校领导列表")
    @Permission(permission = "admin:shop_expand:getLeaderList")
    public ApiResult<Object> getLeaderList(@RequestBody Leader leader){
        return ApiResult.newSuccess(shopExpandService.getLeaderList(leader));
    }


    @PostMapping("/getLeaderInfo")
    @ApiOperation("学校领导详情")
    @Permission(permission = "admin:shop_expand:getLeaderInfo")
    public ApiResult<Object> getLeaderInfo(@RequestBody Leader leader){
        return ApiResult.newSuccess(shopExpandService.getLeaderInfo(leader));
    }

    @PostMapping("/addOrUpdLeader")
    @ApiOperation("添加或修改学校领导")
    @Permission(permission = "admin:shop_expand:addOrUpdLeader")
    public ApiResult<Object> addOrUpdLeader(@RequestBody Leader leader){
        shopExpandService.addOrUpdLeader(leader);
        return ApiResult.newSuccess();
    }

    @PostMapping("/delLeader")
    @ApiOperation("可批量删除学校领导")
    @Permission(permission = "admin:shop_expand:delLeader")
    public ApiResult<Object> delLeader(@RequestBody Ids ids){
        shopExpandService.delLeader(ids);
        return ApiResult.newSuccess();
    }

    @PostMapping("/getHonorList")
        @ApiOperation("学校荣誉列表")
    @Permission(permission = "admin:shop_expand:getHonorList")
    public ApiResult<Object> getHonorList(){
        return ApiResult.newSuccess(shopExpandService.getHonorList());
    }

    @PostMapping("/getHonorInfo")
    @ApiOperation("学校荣誉详情")
    @Permission(permission = "admin:shop_expand:getHonorInfo")
    public ApiResult<Object> getHonorInfo(@RequestBody Honor honor){
        return ApiResult.newSuccess(shopExpandService.getHonorInfo(honor));
    }

    @PostMapping("/addOrUpdHonor")
    @ApiOperation("增加或修改荣誉")
    @Permission(permission = "admin:shop_expand:addOrUpdHonor")
    public ApiResult<Object> addOrUpdHonor(@RequestBody Honor honor){
        shopExpandService.addOrUpdHonor(honor);
        return ApiResult.newSuccess();
    }

    @PostMapping("/delHonor")
    @ApiOperation("可批量删除荣誉")
    @Permission(permission = "admin:shop_expand:delHonor")
    public ApiResult<Object> delHonor(@RequestBody Ids ids){
        shopExpandService.delHonor(ids);
        return ApiResult.newSuccess();
    }

}
